<%@ page language="java" import="dao.*,java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
 
<html> 
	<head>
		<title>网上超市</title>
	</head>
	<body>
	<div align="left"><br></div><div align="center"> 
    </div><%if(session.getAttribute("loginedUser") != null) {%><div align="right"> 
    欢迎您${loginedUser.usersId }<a href="logout.jsp">登出</a><br></div>
    <%} else { %> 
    <div align="right">欢迎您，您的身份是游客，请您<a href="usersLogin.jsp">登陆</a><br>
    </div><%} %>
    <%  List Good = (List)request.getAttribute("Good");
        if( Good == null) {%>
           所有商品已脱销  
        <% }  else { 
        List Type = (List)request.getAttribute("Type");
        List goods = null;
        GoodsDetail goodsDetail;
        GoodsType goodsType; 
        for(int i = 0 ; i < Type.size() ; i++) {
            goodsType= (GoodsType)Type.get(i);
        %>
        <table width="100%"  border="1" align="center" cellpadding="10" cellspacing="1" class="table-bgcolor">
            <tr class="table-head">
                <%=goodsType.getTypeName() %>
            </tr>
            <% goods = (List)Good.get(i);
               if(goods == null){%>
               <tr>该类商品已脱销</tr> 
               <%} else {
               for(int j = 0 ; j < goods.size() ; j++){
               goodsDetail = (GoodsDetail)goods.get(j);
               %>
               <tr>
               <a href=""><%=goodsDetail.getGoodsName() %></a>
               </tr>
               <%}%>
               
               <%}%>
        </table>
		<% } %>
		<br>
		<br>
		<%}%>
		<html:form action="/goodsShow">
			<html:hidden property="goodsDetailId" value="null"/><html:errors property="goodsDetailId"/><br/>
			<div align="center"><html:submit value="刷新"/></div>
		</html:form>
	</body>
</html>

